package com.hxk.demo.controller;

import cn.hutool.json.JSONObject;
import com.hxk.demo.dto.EcgAnalysisDTO;
import com.hxk.demo.service.EcgServiceI;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * @author lyl
 */
@Slf4j
@RestController
@RequestMapping("/ecg")
public class EcgController {

    @Resource
    private EcgServiceI ecgServiceI;

    /**
     * 分析心电文件
     *
     * @param dto 参数
     * @return JSONObject
     */
    @PostMapping(value = "/analysis")
    public JSONObject analysis(EcgAnalysisDTO dto) {
        if (dto.getEcgFile() == null) {
            // 处理文件为空错误
        }
        return ecgServiceI.analysis(dto);
    }
}
